function [lIndex,record] = nnStrategy(x, y, l_ind, records, models, i)
%FUNCTION `nnStrategy` compute the sum of all instances to its nn labeled
%instance, then select the candidate which minimize the sum to label
%@records   record the the nearest distance in last iteration
    %ignore the i=1 first
    u_ind = setdiff(1:numel(x), l_ind{i});
    dis_buff = records{1};
    dis_tmp = zero(numel(u_ind), numel(x));
    
    if i > 1
        record = records{i};
    else
        %
        record = zeros(numel(x));
        for k = 1:numel(x)
            record(k) = inf;
            for j = 1:numel(l_ind)
                if dis_buff(k, l_ind(j)) < record(k)
                    record(k) = dis_buff(k, l_ind(j));
                end
            end
        end
    end
        
    for k = 1:numel(u_ind)
        candidate_ind = u_ind(k);
        for j = 1:numel(x)
            if record(k) > dis_buff(j, candidate_ind)
               dis_tmp(k, j) = record(k) - dis_buff(j, candidate_ind);% sub
            end
        end
    end
    sums = sum(dis_tmp, 2);
    [~, min_ind] = min(sums);
    record = record - sums(min_ind, :);
    lIndex = [l_ind{i}, u_ind(min_ind)];
end